// componments/mylist/mylist.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    num:{
      type:String,
      observer:function(newVal,oldVal){
        console.log('properties-num',newVal)
      }
    },
    person:{
      type:Object,
      observer:function(newVal,oldVal){
        console.log('properties-person',newVal)
      }
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    aloneVal:0,
    oneVal:null,
    twoVal:null
  },
  observers:{
    'num'(val){
      console.log('observes-num:' + val)
    },
    'person.name'(val){
      console.log('observes-person:'+val)
    },
    'aloneVal'(val){
      console.log('observes-aloneVal：'+val)
    },
    'oneVal,twoVal'(val1,val2){
      console.log('observes-oneVal'+val1);
      console.log('observes-twoVal'+val2)
    }
    
  },
  /**
   * 组件的方法列表
   */
  methods: {
    bindinputVal(e){
      this.setData({
        aloneVal:e.detail.value
      })
    },
    bindinputOneVal(e){
      this.setData({
        oneVal:e.detail.value
      })
    },
    bindinputTwoVal(e){
      this.setData({
        twoVal:e.detail.value
      })
    },
    changename(e){
      console.log('更改name:'+e.detail.value)
      this.setData({
        'person.name':e.detail.value
      })
      this.triggerEvent("mypar",this.data.person);
    }
  }

})
